import axios from '@/utils/service'
import type { Note } from '@/stores/types'

/** 获取便签列表 */
export function getNotesList<T>(page: number, size: number) {
  return axios.get<T, T>(`/note/page/${page}/${size}`)
}

// id 查询
export function getNoteById<T>(id: string) {
  return axios.get<T, T>(`/note/id/${id}`)
}
// 搜索API
export function getNoteListByContent<T>(content: string) {
  return axios.get<T, T>(`/note/content/${content}`)
}
// 添加note
export function addNote<T>(note: Note) {
  return axios.post<T, T>('/note', note)
}

// 删除note
export function deleteNote<T>(id: string) {
  return axios.delete(`/note/${id}`)
}

// 修改note
export function updateNote<T>(id: string, note: Note) {
  return axios.put(`/note/${id}`, note)
}
